import request from '@/utils/request'

/**
 * 获取分类列表
 */
export function getCategory(params) {
  return request({
    url: '/categories',
    params
  })
}

/**
 * 添加分类
 */
export function addCategory(data) {
  return request({
    url: '/categories',
    method: 'post',
    data
  })
}

/**
 * 数据总数
 */
export function count(params) {
  return request({
    url: '/categories/count',
    params
  })
}

/**
 * 编辑分类
 */
export function editCategory(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 删除分类
 */
export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'
  })
}
